package com.sjb.singleSingleton;

/**
 * Created with IntelliJ IDEA.
 * 双重校验锁的懒汉实现方式
 * @Author: 有点儿意思
 * @Description:
 */
public class DoubleCheckLazySingleton {

    private static volatile DoubleCheckLazySingleton instance = null;

    public DoubleCheckLazySingleton(){
    }

    public static DoubleCheckLazySingleton getInstance (){
        if (instance == null){
            synchronized (DoubleCheckLazySingleton.class){
                if (instance == null){
                    instance = new DoubleCheckLazySingleton();
                }
            }
        }
        return instance;
    }

}
